
// import TableList from "@components/templates/tablelist";
import TableList from "@components/templates/customtablelist";
import { HttpBillCustomerDetail } from '@/service/api/views';
import { mapState,mapGetters } from "vuex";
export default {
    props:['totalid'],
    mixins: [TableList],
    data() {
        return {
            // totals: 0,
            isMixin: true,
            Tools: {show: true},
            Tabs: {show: true},
            formData:{
                search:{
                }
            },
            Searchs: {
                show: true,
                labelWidth: 120,
            },
            Plugins: {show: true},
        }
    },
    methods: {
        ajaxRequest: HttpBillCustomerDetail,
        interceptRequest (params) {
            if (params.search.EQ_month&&params.search.EQ_month[0]!='') {
                params.search.EQ_month = this.handleDateFormat(params.search.EQ_month,'yy-mm')+'-01'
            }
            return params
        },
        interceptRequest (params) {
            if(this.totalid>0){
                params.search.EQ_billId = this.totalid
            }
            return params
        },
        handleOperates(params="", type,batch) {
            if(batch===true){
                params=(params||this.checkedData.join(','))+'';
                if(!params.length) return this.$Message.warning('请选择至少一条数据');
            }
            switch (type) {
                case 'exportQuery':
                    this.handleWebfs(process.env.VUE_APP_APIURL_SHIP + "/api/jwt/spl/bill/manage/exportDetail", 'download')
                break
                
            }
        },
    },
    computed: {
        ...mapGetters('dictionary', ['getSysAllList']),
        // 搜索下拉框展示内容
        SearchsData() {
            return  [
                {
                    label: '组织',
                    key: 'EQ_organizationId',
                    tag: 'Select',
                    options: this.getSysAllList,
                    props:{
                        filterable:true,
                    },
                    show: true,
                },
                {
                    label: '运单号',
                    tag: 'Input',
                    key: 'EQ_trackingNo',
                    show:true,
                },

                {
                    label: '关联单号',
                    tag: 'Input',
                    key: 'EQ_parcelNo',
                    show:true,
                },
                {
                    label: '月份',
                    tag: 'DatePicker',
                    key: 'EQ_month',
                    props:{
                        type:'month',
                        confirm:false,
                    },
                    // hideSearchTip:true,
                },
            ]
        },
        ToolsData(){
            return [
                {
                    name: "导出",
                    theme: 'info',
                    operate: 'exportQuery',
                },
            ]
        },
        // table的展示数据
        columns() {
            return [{
                title: "账户组织",
                key: "organizationName",
                sortable: true,
            }, {
                title: "扣费项",
                key: "type",
                sortable: true,
                render(h, { row }) {
                    return <span>{row.type == 0 ? '运费' : '调整单'}</span>
                }
            }, {
                title: "运单号",
                key: "trackingNo",
                sortable: true,
            },{
                title: "关联单号",
                key: "tradeNo",
                sortable: true,
            }, {
                title: "月份",
                key: "month",
                sortable: true,
                render(h, { row }) {
                    return <span>{(row.month || "").substr(0, 7)}</span>
                }
            }, 
            {
                title: "收费项",
                key: "costName",
                sortable: true,
                // render(h, { row }) {
                //     return <span>{row.expenditure == 0 ? '收入' : '支出'}</span>
                // }
            },{
                title: "收费金额（USD）",
                key: "totalAmout",
                sortable: true,
                render(h, { row }) {
                    return <span>{row.expenditure == 1 ? '-' : ''}{row.totalAmout}</span>
                }
            }, 
            ]
        },
        
    },

};
